package com.ai.bitcoin.jpa.dao;

import com.ai.bitcoin.jpa.entity.BccUserWxinfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

public interface BccUserWxinfoDao extends JpaRepository<BccUserWxinfo, String> {

    @Query(nativeQuery = true, value = "update bcc_user_wxinfo set image = ?1,nickname = ?2 where open_id = ?3")
    @Modifying
    void updateWxinfo(String image, String nickname, String openId);

    @Query(value = "select * from bcc_user_wxinfo where open_id = ?1 for UPDATE ", nativeQuery = true)
    BccUserWxinfo findByOpenId(String openId);
}
